Unit IV kickoff: A deep dive into the architectural shift from Centralized to Distributed Version Control, understanding the Local Repository, and exploring the Multiple Repositories Model.
The fundamental difference lies in where the history lives. Let's compare the topologies.
.git/) on your hard drive. It is a complete, self-contained database containing every commit, every branch, and every tag ever created in the project.git log (view history) or git checkout (switch branches) do not require a network request. They execute in milliseconds.push or pull from others.To manage the local repository, Git uses a three-stage architecture. Understanding these "three trees" is the key to mastering Git.
The actual files you see and edit on your computer. It's a single checkout of one version of the project.
A preparatory area. You "stage" specific changes here to build exactly what you want your next commit to look like.
.git directory)The database where Git permanently stores the metadata and object database for the committed snapshots.
SVN and Mercurial do not have a staging area. If you type svn commit, it commits every changed file. Why did Git add this extra step?
The staging area allows you to craft logical commits. You can modify 10 files, but stage and commit them as 3 separate, well-documented features.
login.js and footer.css at the same time. They are unrelated. The staging area lets you commit login.js first as "Fix login", then footer.css as "Update styling".git diff --staged lets you see exactly what is about to be permanently saved to the repository, acting as a final sanity check.git add -p).Because every clone is a full repository, DVCS inherently supports a Multiple Repositories Model. There is no technical "master" server — only a social one.
origin pointing to that URL. origin is just a convention, not a magical technical keyword.The multiple repositories model allows for complex workflows. The most common in open-source (and enterprise via Pull Requests) is the Integration-Manager workflow.
Combining the Local Repository with the Multiple Repositories model, a code change moves through four distinct stages.
git addgit commit.git/ database.git pushgit pull their changes, merge them with yours locally, and then git push the combined result.Because DVCS allows unlimited repository topologies, massive projects (like the Linux kernel) use this hierarchical multi-repository model.
main.Today we broke down the architecture of Distributed Version Control, focusing on local repositories and multi-repo workflows.
git fetch (downloads data) and git pull (downloads AND merges). Know why the staging area exists.